package billing.spider.thread.spiders;

import java.util.List;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;

import billing.spider.bean.BaseSpider;
import billing.spider.help.Config;
import billing.spider.thread.MainSpiderExecute;
import billing.system.logger.Logger;

public class ThisPageDtl extends MainSpiderExecute{

	public Element  elem = null;
	public ThisPageDtl(Class<?> type, Element elem) {
		logger = Logger.getLogger(type);
		String key = type.getName();
		config = configPool.get(key);
		if(null == config){
			config = Config.getConfig(type);
			configPool.put(type.getName(), config);
		}
		try {
			root =  (BaseSpider) type.newInstance();
		} catch (Exception e) {
			logger.error("new BaseSpider instance has error! ", e);
		}
		this.elem = elem;
	}

	public List<BaseSpider> getResults() {
		return execute(root,Jsoup.parse(elem.toString()));
	}

}
